<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title></title>
	<link rel="stylesheet" type="text/css" href="${path}/css/main.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/mainTable.css">
	<script type="text/javascript">
		function removeLimitBusiness(lower_id, province, lower_name){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/limitBusiness/deleteLimitBusiness.action";
				var params = "limitBusinessVo.lower_id="+lower_id+"&limitBusinessVo.province="+province+"&limitBusinessVo.lower_name="+lower_name;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
		
		function removeLowerLimitBusiness(lower_id,lower_name){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/limitBusiness/deleteLowerLimitBusiness.action";
				var params = "limitBusinessVo.lower_id="+lower_id+"&limitBusinessVo.lower_name="+lower_name;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
		
	</script>
  </head>
  <body>
    <div>
    	<p>新增省份管控配置 <a href="${path }/limitBusiness/addLimitBusiness.action" title="添加省份管控配置">添加</a></p>
    	<div>
    		<table>
    			<thead>
    				<tr>
    					<th>编号</th>
    					<th>渠道名称</th>
    					<th>省份</th>
    					<th>日限(元)</th>
    					<th>月限(元)</th>
    					<th>省份操作</th>
    					<th>渠道操作</th>
    				</tr>
    			</thead>
    			<c:choose>
    				<c:when test="${limitBusinessMapVoList != null && fn:length(limitBusinessMapVoList) > 0}">
    					<c:forEach var="limitBusinessMapVo" items="${limitBusinessMapVoList }" varStatus="list">
    						<c:if test="${limitBusinessMapVo.limitBusinessVoList != null && fn:length(limitBusinessMapVo.limitBusinessVoList) > 0 }">
    							<c:forEach var="limitBusinessVo" items="${limitBusinessMapVo.limitBusinessVoList }" varStatus="i">
    								<c:choose>
    									<c:when test="${i.index == 0 }">
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }" >
				    							<td rowspan="${fn:length(limitBusinessMapVo.limitBusinessVoList) }">${list.index + 1 }</td>
				    							<td rowspan="${fn:length(limitBusinessMapVo.limitBusinessVoList) }">
				    								<a href="${path }/limitBusiness/modifyLowerLimitBusiness.action?limitBusinessVo.lower_id=${limitBusinessMapVo.lower_id }">${limitBusinessMapVo.lower_name }</a>
				    							</td>
				    							<td>
				    								<a href="${path }/limitBusiness/modifyLimitBusiness.action?limitBusinessVo.lower_id=${limitBusinessMapVo.lower_id }&limitBusinessVo.province=${limitBusinessVo.province }">${limitBusinessVo.province }</a>
				    							</td>
				    							<td>${limitBusinessVo.day_limit }</td>
				    							<td>${limitBusinessVo.month_limit }</td>
				    							<td>
				    								<a href="javascript:removeLimitBusiness(${limitBusinessVo.lower_id },'${limitBusinessVo.province }','${limitBusinessMapVo.lower_name }');">删除</a>
				    							</td>
				    							<td rowspan="${fn:length(limitBusinessMapVo.limitBusinessVoList) }">
				    								<a href="javascript:removeLowerLimitBusiness(${limitBusinessMapVo.lower_id }, '${limitBusinessMapVo.lower_name }');">删除</a>
				    							</td>
				    						</tr>
    									</c:when>
    									<c:otherwise>
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }" >
				    							<td>
				    								<a href="${path }/limitBusiness/modifyLimitBusiness.action?limitBusinessVo.lower_id=${limitBusinessMapVo.lower_id }&limitBusinessVo.province=${limitBusinessVo.province }">${limitBusinessVo.province }</a>
				    							</td>
				    							<td>${limitBusinessVo.day_limit }</td>
				    							<td>${limitBusinessVo.month_limit }</td>
				    							<td><a href="javascript:removeLimitBusiness(${limitBusinessVo.lower_id },'${limitBusinessVo.province }','${limitBusinessMapVo.lower_name }');">删除</a></td>
				    						</tr>
    									</c:otherwise>
    								</c:choose>
    							</c:forEach>
    						</c:if>
    					</c:forEach>
    				</c:when>
    				<c:otherwise>
    					<tr>
    						<td>暂无渠道省份管控配置<td>
    					</tr>
    				</c:otherwise>
    			</c:choose>
    		</table>
    	</div>
    </div>
  </body>
</html>
